<include file="Common:layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>商品品牌 - 修改品牌</h3>
                <h5>修改商品品牌</h5>
            </div>
        </div>
    </div>

    <form action="{:U('Brand/edit')}" method="post" class="form-horizontal" id="brand_form">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label><em>*</em>品牌名称</label>
                </dt>
                <dd class="opt">
                    <input type="text" placeholder="名称" class="input-txt" name="b_name" value="{$brand['b_name']}" id="b_name">
                    <span class="err" id="c_name" style="color:#F00; display:none;"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit" colspan="2">
                    <label>是否代理品牌</label>
                </dt>
                <dd class="opt">
                    <div id="gcategory">
                        <select name="brand" class="class-select valid">
                            <option value="0">否</option>
                            <option value="1" <if condition="$brand['agent_brand'] eq 1">selected</if>>是</option>
                        </select>
                    </div>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit" colspan="2">
                    <label>返利方式</label>
                </dt>
                <dd class="opt">
                    <div id="gcategory">
                        <select name="rebate" class="class-select valid" id="rebate">
                            <option value="">请选择</option>
                            <foreach name="rebates" item="rebate">
                                <option value="{$rebate['re_id']}" <if condition="$brand['rebate_id'] eq $rebate['re_id']">selected</if>>{$rebate['type_name']}</option>
                            </foreach>
                        </select>
                    </div>
                </dd>
            </dl>

            <dl class="row">
                <dt class="tit">
                    <label>品牌图片</label>
                </dt>
                <dd class="opt">
                    <div class="input-file-show">
                        <span class="show">
                            <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$brand['pic']}">
                                <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src={$brand['pic']}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                            </a>
                        </span>
                        <span class="type-file-box">
                            <input type="text" id="image" name="pic" value="{$brand['pic']}" class="type-file-text">
                            <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                            <input class="type-file-file" onClick="GetUploadify(1,'','brand','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
                        </span>
                    </div>
                    <span class="err"></span>
                    <p class="notic">请上传图片格式文件</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit" colspan="2">
                    <label>品牌描述</label>
                </dt>
                <dd class="opt">
                    <div id="gcategory">
                        <textarea rows="3" cols="80" name="info" class="input-txt">{$brand['info']}</textarea>
                    </div>
                </dd>
            </dl>

            <input type="hidden" name="brand_id" value="{$brand['id']}"/>
            <div class="bot"><a id="submitBtn" class="ncap-btn-big ncap-btn-green" href="JavaScript:void(0);">确认提交</a></div>
        </div>
    </form>
</div>
<script>
    function img_call_back(fileurl_tmp)
    {
        $("#image").val(fileurl_tmp);
        $("#img_a").attr('href', fileurl_tmp);
        $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
    }

    $("#submitBtn").click(function() {
        var b_name = $('#b_name').val();
        var rebate = $('#rebate').val();
        var brand  = $('#brand').val();
        if (b_name == '' && brand==1 ) {
            layer.msg('请填写品牌名称!', {icon:2, time:1000});
            return false;
        }
        if (rebate == '') {
            layer.msg('请选择返利方式!', {icon:2, time:1000});
            return false;
        }
        $("#brand_form").submit();
    });
</script>
</body>
</html>